import 'base_model.dart';

/// 作者相关信息
class AuthorModel extends BaseModel {
  String name; // 名称
  String sculpture; // 图片链接
  String summary; // 概要
  List<RelatedComic> relatedComics = new List<RelatedComic>(); // 关联漫画

  AuthorModel.fromJson(Map<String, dynamic> data) : super.fromJson(data) {
    name = data["name"];
    sculpture = data["sculpture"];
    summary = data["summary"];
    data["related_comic"].forEach((item) {
      relatedComics.add(RelatedComic.fromJson(item));
    });
  }

  @override
  Map<String, dynamic> toJson() {
    return {
      "modelState": modelState,
      "sculpture": sculpture,
      "relatedComics": relatedComics
    };
  }
}

class RelatedComic extends BaseModel {
  int cartoonId; // 漫画id
  String cartoonName; // 漫画名称
  String comicCover34; // 漫画封面
  String lastChapterName; // 最新章节名称

  RelatedComic.fromJson(Map<String, dynamic> data) : super.fromJson(data) {
    cartoonId = data["cartoon_id"];
    cartoonName = data["cartoon_name"];
    comicCover34 = data["comic_cover_34"];
    lastChapterName = data["last_chapter_name"];
  }

  @override
  Map<String, dynamic> toJson() {
    return {
      "modelState": modelState,
      "cartoonId": cartoonId,
      "cartoonName": cartoonName,
      "comicCover34": comicCover34
    };
  }
}
